﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Ylh.BLL;
using System.Data;

public partial class Module_CompanyManger_CompanyManger : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadTv();
        }


    }

    private void LoadTv()
    {
        Ylh.BLL.DepartmentBLL blld = new Ylh.BLL.DepartmentBLL(DbConnectionStr);

        DataTable dt = blld.GetDepartMentInfo(-1);


        Tree1.Nodes.Clear();

        ExtAspNet.TreeNode Tn = new ExtAspNet.TreeNode();
        Tn.Text = "伊洛汉有限公司";

        Tn.Leaf = false;
        Tree1.Nodes.Add(Tn);
        ExtAspNet.TreeNode tn;
        foreach (DataRow dr in dt.Rows)
        {
            tn = new ExtAspNet.TreeNode();
            tn.Text = dr["DepartmentName"].ToString();
            tn.NodeID =dr["DepartmentID"].ToString();
            tn.Leaf = true;
            tn.NavigateUrl = "../DepartmentManger/DepartmentManger.aspx?DepartmentID=" +dr["DepartmentID"].ToString();
            tn.Target = "Department";

            Tn.Nodes.Add(tn);
        }
    }
}